// DShowPlayer.cpp : Defines the exported functions for the DLL application.
//

//#pragma comment(lib,"Strmiids.lib")

#include "stdafx.h"
#include "DShowPlayer.h"


// This is an example of an exported variable
DSHOWPLAYER_API int nDShowPlayer=0;

// This is an example of an exported function.
DSHOWPLAYER_API int fnDShowPlayer(void)
{
	return 42;
}

//Control objects linked into DirectShow
IMediaControl *pControl;
IMediaEvent *pEvent;

//Flag if player initialized ok
bool isInitialized = false;

// This is the constructor of a class that has been exported.
// see DShowPlayer.h for the class definition
DShowPlayer::DShowPlayer()
{
	//Initialize COM Library
	HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
	if (FAILED(hr)) {
		//Oh noes, it failed
	}
	//Setup the filter graph manager
	IGraphBuilder *pGraph;
	hr = CoCreateInstance(CLSID_FilterGraph, NULL,
		CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&pGraph);
	if (FAILED(hr)) {
		
	}
	//Get IMediaControl
	hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
	if (FAILED(hr)) {

	}	
	//Get IMediaEvent (event when playback finishes)
	hr = pGraph->QueryInterface(IID_IMediaEvent, (void **)&pControl);
	if (FAILED(hr)) {

	}
}
